import { _decorator } from 'cc'
import { SubStateMachine } from './SubStateMachine'
import { DIRECTION_ORDER_ENUM, PARAMS_NAME_ENUM } from '../Enum'
const { ccclass, property } = _decorator

/**
 * Predefined variables
 * Name = DirectionSubStateMachine
 * DateTime = Sun Jul 10 2022 20:54:27 GMT+0800 (中国标准时间)
 * Author = Zero_Y
 * FileBasename = DirectionSubStateMachine.ts
 * FileBasenameNoExtension = DirectionSubStateMachine
 * URL = db://assets/Base/DirectionSubStateMachine.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 * 只是为了抽离run方法，在Idle | Turn SubStateManager，转向动画和方向动画播放
 *
 */

@ccclass('DirectionSubStateMachine')
export class DirectionSubStateMachine extends SubStateMachine {
  run(): void {
    const value = this.fsm.getParams(PARAMS_NAME_ENUM.DIRECTION)
    this.currentState = this.stateMachines.get(DIRECTION_ORDER_ENUM[value as number])
  }
}
